package com.niiwoo.civet.user.service.local;

import com.niiwoo.civet.user.dao.entity.IdentityMapping;
import com.niiwoo.civet.user.dao.mapper.IdentityMappingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 身份映射本地服务 userId : id_card = 1 : 1
 */
@Service
public class IdentityMappingService {

    @Autowired
    IdentityMappingMapper identityMappingMapper;

    /**
     * 是否存在映射关系
     *
     * @param idCardNo 身份证号密文
     */
    public boolean isExists(String idCardNo) {
        return get(idCardNo) != null;
    }

    /**
     * 查询映射
     *
     * @param idCardNo 身份证号密文
     */
    public IdentityMapping get(String idCardNo) {
        return identityMappingMapper.selectByPrimaryKey(idCardNo);

    }
}
